<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"> 

<h:head></h:head> 
<body> 
<ui:composition template="/templates/templateListar.xhtml">
		<ui:define name="conteudo">
			
			<p:growl id="mensagem" showDetail="true" autoUpdate="false"
				closable="true" />
			<h:form id="frmUsuario">

				<p:hotkey bind="esc"
					handler="document.getElementById('frmTab:btnCancelar').click()" />

				<p:fieldset legend="Cadastro de Raças" toggleable="true"
					collapsed="false" toggleSpeed="500">
					<!-- teirei aqui -->
					<h:panelGrid columns="5" style="border:0px">

						
						<p:commandLink actionListener="#{racaMB.abrirModal}"
							title="Incluir" update=":dialogCadastro"
							oncomplete="dialogCadastroRaca.show()">
							<p:graphicImage value="/imagens/busca_4.jpg" />
							<f:setPropertyActionListener value="#{item}"
								target="#{racaMB.racaSelecionada}" />
							<f:param name="modooperacao" value="INCLUIR" />
						</p:commandLink>


<!--tirei reset -->


					</h:panelGrid>
				</p:fieldset>


			</h:form>

			<h:form id="frmTab">
				<p:commandButton id="btnCancelar" action="#{racaMB.sair}"
					style="display:none" value="cancelar" />
				<p:dataTable id="tabela" var="item" value="#{racaMB.listaRaca}"
					paginator="true" rows="50" emptyMessage="Não há registros"
					paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="10,15,25,50,100">
					<f:facet name="header">Raças</f:facet>
					<p:column headerText="ID" style="width: 10%;" sortBy="#{item.codigo}">
						<h:outputText value="#{item.codigo}" />
					</p:column>
					<p:column headerText="Descricão" style="width: 25%;"
						sortBy="#{item.nome}">

						<h:outputText value="#{item.descricao}" />

					</p:column>
					<p:column headerText="Porte" style="width: 25%;"
						sortBy="#{item.porte.descricao}">

						<h:outputText value="#{item.porte.descricao}" />

					</p:column>
					

					<p:column headerText="Ações"
						style="width: 30%;horizontal-align:center">

						<p:commandLink title="Alterar"
							actionListener="#{racaMB.abrirModal}" update=":dialogCadastro"
							oncomplete="dialogCadastroRaca.show()">
							<p:graphicImage value="/imagens/alt_1.jpg" />
							<f:setPropertyActionListener value="#{item}"
								target="#{racaMB.racaSelecionada}" />
							<f:param name="modooperacao" value="ALTERAR" />
						</p:commandLink>

						<p:commandLink actionListener="#{racaMB.abrirModal}"
							title="Consultar" update=":dialogCadastro"
							oncomplete="dialogCadastroRaca.show()">
							<p:graphicImage value="/imagens/busca_4.jpg" />
							<f:setPropertyActionListener value="#{item}"
								target="#{racaMB.racaSelecionada}" />
							<f:param name="modooperacao" value="CONSULTAR" />
						</p:commandLink>

						<p:commandLink title="Excluir" update=":formExcluir:Excluir"
							oncomplete="confirmation.show()" immediate="false">
							<p:graphicImage value="/imagens/exc_1.jpg" />
							<f:setPropertyActionListener
								target="#{racaMB.racaSelecionada}" value="#{item}" />
						</p:commandLink>

					</p:column>


				</p:dataTable>


			</h:form>

			<ui:include src="dialogCadastroRaca.xhtml" />
			<ui:include src="/includes/confirmacaoExcluir.xhtml" />
		</ui:define>
	</ui:composition>
</body> 
</html>
